﻿using System;
using System.Collections.Generic;
using System.Text;
using TomShane.Neoforce.Controls;
using RebEngine.Managers;

namespace RebellionII.GUI.Parts
{
    public class RebUnitPanel
    {
        public GroupPanel GroupPanel { get; set; }
        public Button MoveTransportButton { get; set; }
        public Button ClearButton { get; set; }
        public Button RemoveSelectedButton { get; set; }

        public ListBox ListOfUnits { get; set; }
        

        public RebUnitPanel(Control parentControl, int left, int top)
        {
            GroupPanel = new GroupPanel(InputManager.Manager);
            GroupPanel.Init();
            GroupPanel.Left = left;
            GroupPanel.Top = top;
            GroupPanel.Anchor = Anchors.Top | Anchors.Right;
            GroupPanel.Text = "Move Panel";
            GroupPanel.Width = 160;
            GroupPanel.Height = parentControl.Height - 42;
            parentControl.Add(GroupPanel);

            ListOfUnits = new ListBox(InputManager.Manager);
            ListOfUnits.Init();
            ListOfUnits.Left = 2;
            ListOfUnits.Top = 2;
            ListOfUnits.Width = GroupPanel.Width- 5;
            ListOfUnits.Height = GroupPanel.Height - 80;
            ListOfUnits.Anchor = Anchors.All;

            GroupPanel.Add(ListOfUnits);

            ClearButton = new Button(InputManager.Manager);
            ClearButton.Init();
            ClearButton.Left = ListOfUnits.Left;
            ClearButton.Top = ListOfUnits.Top + ListOfUnits.Height + 3;
            ClearButton.Width = 45;
            ClearButton.Height = 25;
            ClearButton.Text = "Clear";
            ClearButton.Anchor = Anchors.Bottom | Anchors.Left;
            GroupPanel.Add(ClearButton);

            RemoveSelectedButton = new Button(InputManager.Manager);
            RemoveSelectedButton.Init();
            RemoveSelectedButton.Left = ClearButton.Left + ClearButton.Width + 3;
            RemoveSelectedButton.Top = ListOfUnits.Top + ListOfUnits.Height + 3;
            RemoveSelectedButton.Width = 55;
            RemoveSelectedButton.Height = 25;
            RemoveSelectedButton.Text = "Remove";
            RemoveSelectedButton.ToolTip.Text = "Remove Currently selected unit from Transport List";
            RemoveSelectedButton.Anchor = Anchors.Right | Anchors.Bottom | Anchors.Left;
            GroupPanel.Add(RemoveSelectedButton);

            MoveTransportButton = new Button(InputManager.Manager);
            MoveTransportButton.Init();
            MoveTransportButton.Left = RemoveSelectedButton.Left + RemoveSelectedButton.Width + 3;
            MoveTransportButton.Top = ListOfUnits.Top + ListOfUnits.Height + 3;
            MoveTransportButton.Width = 45;
            MoveTransportButton.Height = 25;
            MoveTransportButton.Text = "Move";
            MoveTransportButton.ToolTip.Text = "Create a new transport with the currently selected units from Transport List";
            MoveTransportButton.Anchor = Anchors.Right | Anchors.Bottom;
            GroupPanel.Add(MoveTransportButton);

        }
    }
}
